<?php
ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';
ini_set('memory_limit', '512M');


$level = $argv[1] ?? 0;

if (!$level) {
    echoExit('param level error!!!');
}

$rightsName = $argv[2] ?? 0;

if (!$rightsName) {
    echoExit('param rightsId error!!!');
}

$rightsId = \Biz\service\BrandRights\BrandRightsSourceService::getIdByRightsName($rightsName);
\Biz\cache\brand\LevelRights::unLockLevelRightsConfigure($level, $rightsId);

echoExit("操作已解锁，运营操作后，请执行权益更新脚本！！ php levelRightsUpdate level:{$level} rights_name: {$rightsName} rights_id: {$rightsId}");


function echoExit($msg)
{
    echo $msg . PHP_EOL;
    exit;
}